package leecode

func findLucky(arr []int) int {
	hashMap := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		hashMap[arr[i]]++
	}
	result := -1
	for key, value := range hashMap {
		if key == value {
			result = max(result, key)
		}
	}
	return result
}
